import { ecs } from 'db://app-game/libs/ecs/ECS';
import { Lineup } from '../../level-map/LevelMap.type';

/** 怪兽基础组件 */
@ecs.register('MonsterModel')
export class MonsterModelComp extends ecs.Comp {
  table: TableMonsterType = new TableMonsterType();
  /** 怪兽种类Id */
  private _id: number = -1;
  get id() {
    return this._id;
  }
  set id(val: number) {
    this._id = val;
    this.table.init(val);
  }
  /** 阵容 */
  get formation() {
    return this.table.formation;
  }

  /** 攻击力 */
  get attack() {
    return this.table.attack;
  }
  /** 血量 */
  get hp() {
    return this.table.hp;
  }
  /** 移动速度 */
  get speed() {
    return this.table.speed;
  }
  /** 监视半径 */
  get monitorRange() {
    return this.table.monitorRange;
  }
  /** 攻击范围 */
  get attackRange() {
    return this.table.attackRange;
  }

  /** 预制件路径 */
  get prefabPath() {
    return this.table.prefabPath;
  }

  /** 阵容 */
  lineup: Lineup = Lineup.Player;
  /** 敌对阵容 */
  enemyLineup: Lineup = Lineup.AI;

  reset(entity: ecs.Entity): void {
    this._id = -1;
    this.lineup = Lineup.Player;
    this.enemyLineup = Lineup.AI;
  }
}
